<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
<head>
<meta charset="utf-8" />
<title>员工表</title>
<link rel="stylesheet" href="${pageContext.servletContext.contextPath }/css/my.css">
<link rel="stylesheet" href="${pageContext.servletContext.contextPath }/css/bootstrap.min.css">
<script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript">
	function nextPage(){
		var pageNo = ${currentPage} +1;
		var pageCount = ${pageCount};
		if(pageNo > pageCount){
			pageNo = pageCount;
			alert("已到最后一页！");
		}else{
			window.location.href = "${pageContext.servletContext.contextPath}/user_list.servlet?currentPage="+pageNo;
		}
	}
	
	function previousPage(){
		var pageNo = ${currentPage} -1;
		if(pageNo == 0){
			pageNo =1;
			alert("已到首页");
		}else{
			window.location.href = "${pageContext.servletContext.contextPath}/user_list.servlet?currentPage="+pageNo;
		}
	}
	function firstPage(){
		var pageNo = 1;
		window.location.href = "${pageContext.servletContext.contextPath}/user_list.servlet?currentPage="+pageNo;
	}
	function lastPage(){
		var pageNo = ${pageCount};
		window.location.href = "${pageContext.servletContext.contextPath}/user_list.servlet?currentPage="+pageNo;
	}
</script>
</head>
<body>

	<div class="emp_contaner">
		<h3>用户列表</h3>
		<table class="table table-bordered table-striped table-hover">
			<tr>
				<th>头像</th>
				<th>名称</th>
				<th>密码</th>
				<th colspan="2">操作</th>
			</tr>
			<c:forEach var="user" items="${userLists}">
				<tr>
					<td><img src="${user.headerUri}" width="60px" height="60px"></td>
					<td>${user.userName}</td>
					<td>${user.passWord }</td>
					<td><a href="#" onclick="deleteRow(this)">删除</a></td>
					<td><a href="#" onclick="updateDepartName(this)">修改</a></td>
				</tr>
			</c:forEach>
		</table>
		<div>
			<br>共${pageCount }页&nbsp;&nbsp;当前第${currentPage }页&nbsp;&nbsp;
			<a href="javascript:void(0)" onclick="firstPage();">首页</a>
			<a href="#" onclick="previousPage();">上一页</a>
			<a href="#" onclick="nextPage();">下一页</a>
			<a href="#" onclick="lastPage();">尾页</a>
		</div>
	</div>
</body>
</html>